Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[upstream] 2024-04-23 #2965

Open
wants to merge 125 commits into
base: gcc-patch-dev
Choose a base branch
from

Conversation

CohenArthur
Copy link
Member

This is a draft, as we still need some build system changes to be integrated before sending these. Should hopefully address the shortcomings of #2921

tschwinge and others added 8 commits August 1, 2024 12:47
'gcc/tree.h':

    #define main_identifier_node		global_trees[TI_MAIN_IDENTIFIER]
    #define MAIN_NAME_P(NODE) \
      (IDENTIFIER_NODE_CHECK (NODE) == main_identifier_node)

..., which is not initialized by default, but has to be set up by every front
end individually.  'MAIN_NAME_P' enables certain code optimizations, but is
especially also relevant for back ends that emit additional program entry setup
code for 'main'.

	gcc/rust/
	* backend/rust-compile-base.cc (HIRCompileBase::compile_function):
	For 'main', initialize 'main_identifier_node'.
gcc/rust/ChangeLog:

	* hir/rust-ast-lower-pattern.cc
	(ASTLoweringPattern::visit):
	Reset is_let_top_level while visiting GroupedPattern.

gcc/testsuite/ChangeLog:

	* rust/compile/let_alt.rs: Check for false positive.

Signed-off-by: Owen Avery <[email protected]>
gcc/rust/ChangeLog:

	* rust-lang.cc (grs_langhook_type_for_mode): simplify code for
	xImode. Add missing long_double_type_node.

Signed-off-by: Marc Poulhiès <[email protected]>
This commit adds a base class for parsing the various constructs of a
Rust format string, according to the grammar in the reference:

https://doc.rust-lang.org/std/fmt/index.html#syntax

gcc/rust/ChangeLog:

	* Make-lang.in: Compile rust-fmt object
	* ast/rust-fmt.cc: New file.
	* ast/rust-fmt.h: New file.
Compile libformat_parser and link to it.

gcc/rust/ChangeLog:

	* Make-lang.in: Compile libformat_parser.
	* ast/rust-fmt.cc: New FFI definitions.
	* ast/rust-fmt.h: Likewise.
	* expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler): Call
	into libformat_parser.
	* expand/rust-macro-builtins.h: Define format_args!() handler proper.

libgrust/ChangeLog:

	* libformat_parser/Cargo.lock: New file.
	* libformat_parser/Cargo.toml: New file.
	* libformat_parser/generic_format_parser/Cargo.toml: New file.
	* libformat_parser/generic_format_parser/src/lib.rs: New file.
	* libformat_parser/src/bin.rs: New file.
	* libformat_parser/src/lib.rs: New file.
... to avoid verbatim repetition.

	gcc/rust/
	* Make-lang.in (LIBPROC_MACRO_INTERNAL): New.
	(RUST_LIBDEPS, crab1$(exeext), rust/libformat_parser.a): Use it.
This commits vendors and locks our dependencies so that our Rust components
do not need internet access to be built anymore. Tested in a docker container
with no network access.

We can think about merging the vendor directory once we have more than one
Rust component, e.g. when we add polonius to the mix.

libgrust/ChangeLog:

	* libformat_parser/.cargo/config: New file.
	* libformat_parser/vendor.NOTES: New file.
	* libformat_parser/vendor/libc/.cargo-checksum.json: New file.
	* libformat_parser/vendor/libc/CONTRIBUTING.md: New file.
	* libformat_parser/vendor/libc/Cargo.toml: New file.
	* libformat_parser/vendor/libc/LICENSE-APACHE: New file.
	* libformat_parser/vendor/libc/LICENSE-MIT: New file.
	* libformat_parser/vendor/libc/README.md: New file.
	* libformat_parser/vendor/libc/build.rs: New file.
	* libformat_parser/vendor/libc/rustfmt.toml: New file.
	* libformat_parser/vendor/libc/src/fixed_width_ints.rs: New file.
	* libformat_parser/vendor/libc/src/fuchsia/aarch64.rs: New file.
	* libformat_parser/vendor/libc/src/fuchsia/align.rs: New file.
	* libformat_parser/vendor/libc/src/fuchsia/mod.rs: New file.
	* libformat_parser/vendor/libc/src/fuchsia/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/fuchsia/riscv64.rs: New file.
	* libformat_parser/vendor/libc/src/fuchsia/x86_64.rs: New file.
	* libformat_parser/vendor/libc/src/hermit/aarch64.rs: New file.
	* libformat_parser/vendor/libc/src/hermit/mod.rs: New file.
	* libformat_parser/vendor/libc/src/hermit/x86_64.rs: New file.
	* libformat_parser/vendor/libc/src/lib.rs: New file.
	* libformat_parser/vendor/libc/src/macros.rs: New file.
	* libformat_parser/vendor/libc/src/psp.rs: New file.
	* libformat_parser/vendor/libc/src/sgx.rs: New file.
	* libformat_parser/vendor/libc/src/solid/aarch64.rs: New file.
	* libformat_parser/vendor/libc/src/solid/arm.rs: New file.
	* libformat_parser/vendor/libc/src/solid/mod.rs: New file.
	* libformat_parser/vendor/libc/src/switch.rs: New file.
	* libformat_parser/vendor/libc/src/teeos/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/aix/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/aix/powerpc64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/b32/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/b32/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/aarch64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/aarch64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/x86_64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/x86_64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/long_array.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/errno.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/arm.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/b64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/b64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd13/b64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd13/x86_64.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd14/b64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd15/b64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd15/x86_64.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/powerpc.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/riscv64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/aarch64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/arm.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mips.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/powerpc.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/riscv64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/sparc64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/x86.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/x86_64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/aarch64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/arm.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/mips64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/powerpc.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/powerpc64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/riscv64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/sparc64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/x86.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/x86_64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/haiku/b32.rs: New file.
	* libformat_parser/vendor/libc/src/unix/haiku/b64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/haiku/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/haiku/native.rs: New file.
	* libformat_parser/vendor/libc/src/unix/haiku/x86_64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/hurd/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/hurd/b32.rs: New file.
	* libformat_parser/vendor/libc/src/unix/hurd/b64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/hurd/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/hurd/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b32/arm.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b32/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b32/x86/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b32/x86/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/aarch64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/aarch64/int128.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/aarch64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/riscv64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/riscv64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/x86_64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/x86_64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/emscripten/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/emscripten/lfs64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/emscripten/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/emscripten/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/generic/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/mips/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/powerpc/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/sparc/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/arm/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/arm/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/csky/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/csky/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/m68k/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/mips/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/mips/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/powerpc.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/riscv32/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/sparc/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/x86/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/x86/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/fallback.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/ilp32.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/int128.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/lp64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/loongarch64/align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/mips64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/riscv64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/s390x.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/sparc64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/arm/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/arm/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/hexagon.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/mips/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/mips/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/powerpc.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/riscv32/align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/x86/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/x86/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64/align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64/int128.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/mips64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/powerpc64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/riscv64/align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/s390x.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/x86_64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/lfs64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/non_exhaustive.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/arm/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/arm/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/arm/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips32/align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips32/no_align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips64/align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips64/no_align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/x86_64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/x86_64/other.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/aarch64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/arm/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/espidf/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/generic.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/horizon/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/powerpc/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/vita/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/nto/aarch64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/nto/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/nto/neutrino.rs: New file.
	* libformat_parser/vendor/libc/src/unix/nto/x86_64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/redox/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/solarish/compat.rs: New file.
	* libformat_parser/vendor/libc/src/unix/solarish/illumos.rs: New file.
	* libformat_parser/vendor/libc/src/unix/solarish/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/solarish/solaris.rs: New file.
	* libformat_parser/vendor/libc/src/unix/solarish/x86.rs: New file.
	* libformat_parser/vendor/libc/src/unix/solarish/x86_64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/solarish/x86_common.rs: New file.
	* libformat_parser/vendor/libc/src/vxworks/aarch64.rs: New file.
	* libformat_parser/vendor/libc/src/vxworks/arm.rs: New file.
	* libformat_parser/vendor/libc/src/vxworks/mod.rs: New file.
	* libformat_parser/vendor/libc/src/vxworks/powerpc.rs: New file.
	* libformat_parser/vendor/libc/src/vxworks/powerpc64.rs: New file.
	* libformat_parser/vendor/libc/src/vxworks/x86.rs: New file.
	* libformat_parser/vendor/libc/src/vxworks/x86_64.rs: New file.
	* libformat_parser/vendor/libc/src/wasi.rs: New file.
	* libformat_parser/vendor/libc/src/windows/gnu/align.rs: New file.
	* libformat_parser/vendor/libc/src/windows/gnu/mod.rs: New file.
	* libformat_parser/vendor/libc/src/windows/mod.rs: New file.
	* libformat_parser/vendor/libc/src/windows/msvc/mod.rs: New file.
	* libformat_parser/vendor/libc/src/xous.rs: New file.
	* libformat_parser/vendor/libc/tests/const_fn.rs: New file.
	* libformat_parser/vendor/unicode-xid/.cargo-checksum.json: New file.
	* libformat_parser/vendor/unicode-xid/COPYRIGHT: New file.
	* libformat_parser/vendor/unicode-xid/Cargo.toml: New file.
	* libformat_parser/vendor/unicode-xid/LICENSE-APACHE: New file.
	* libformat_parser/vendor/unicode-xid/LICENSE-MIT: New file.
	* libformat_parser/vendor/unicode-xid/README.md: New file.
	* libformat_parser/vendor/unicode-xid/benches/xid.rs: New file.
	* libformat_parser/vendor/unicode-xid/src/lib.rs: New file.
	* libformat_parser/vendor/unicode-xid/src/tables.rs: New file.
	* libformat_parser/vendor/unicode-xid/src/tests.rs: New file.
	* libformat_parser/vendor/unicode-xid/tests/exhaustive_tests.rs: New file.
	gcc/rust/
	* Make-lang.in (LIBFORMAT_PARSER): Point to the actual build artifact.
	($(LIBFORMAT_PARSER)): Don't cache it.
@CohenArthur CohenArthur force-pushed the prepare-2024-04-23-1713859828942058 branch from bd7a8db to d5c6281 Compare August 1, 2024 10:50
tschwinge and others added 19 commits August 1, 2024 13:11
Fixes Rust-GCC#2883.

gcc/rust/ChangeLog:
	* Make-lang.in (LIBFORMAT_PARSER): Point to the GCC build
	directory.
	* ($(LIBFORMAT_PARSER)): Build in the GCC build directory.
Addresses Rust-GCC#2883.

	contrib/
	* gcc_update (files_and_dependencies): Update for
	'libformat_parser' in libgrust.
	gcc/rust/
	* Make-lang.in (LIBFORMAT_PARSER): Point to 'libformat_parser'
	build in libgrust.
	(%.toml:, $(LIBFORMAT_PARSER):): Remove.
	libgrust/
	* libformat_parser/Makefile.am: New.
	* Makefile.am [!TARGET_LIBRARY] (SUBDIRS): Add 'libformat_parser'.
	* configure.ac: Handle it.
	(TARGET_LIBRARY): New 'AM_CONDITIONAL'.
	* libformat_parser/Makefile.in: Generate.
	* Makefile.in: Regenerate.
	* configure: Likewise.
libgrust/ChangeLog:

	* libformat_parser/generic_format_parser/src/lib.rs: Add generic
	library.
	* libformat_parser/src/lib.rs: Add base for FFI interface.
libgrust/ChangeLog:

	* libformat_parser/cbindgen.toml: New file.
	* libformat_parser/libformat-parser.h: New file.

gcc/rust/ChangeLog:

	* ast/rust-fmt.h: Add remaining FFI types.
gcc/rust/ChangeLog:

	* ast/rust-fmt.cc (Pieces::collect): Use new Pieces API.
	* ast/rust-fmt.h: Update interface with new FFI bindings.

libgrust/ChangeLog:

	* libformat_parser/src/lib.rs: Add IntoFFI trait.
	* libformat_parser/libformat-parser.h: Removed.
gcc/rust/ChangeLog:

	* ast/rust-fmt.cc (Pieces::~Pieces): Call libformat_parser's release
	function in destructor.
	* ast/rust-fmt.h (struct PieceSlice): Add capacity.
	(destroy_pieces): New.
	(struct Pieces): Add destructor.

libgrust/ChangeLog:

	* libformat_parser/src/lib.rs: Leak Boxes properly for C++ to
	see them, add memory release function.
gcc/rust/ChangeLog:

	* expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler):
	Construct string to parser properly.
gcc/rust/ChangeLog:

	* expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler):
	Transform entire invocation token stream into string for the parser.
gcc/rust/ChangeLog:

	* ast/rust-fmt.cc (Pieces::collect): Fix signature to take ownership
	of the given string.
	* ast/rust-fmt.h (struct Pieces): Store parsed string in the struct.

libgrust/ChangeLog:

	* libformat_parser/src/lib.rs: Add debug prompt.
libgrust/ChangeLog:

	* libformat_parser/generic_format_parser/src/lib.rs: Remove
	unused deprecated attribute and unused import.
	* libformat_parser/src/lib.rs: Remove unused import.
Workaround for Ubuntu 18.04, since we still use it for the GCC 4.8 CI.
The default Rust package is 1.65 (and unlikely to change I assume?),
but the generic format parser library uses `is_some_and` which was
introduced in 1.70. So this is a simple reimplementation, directly taken
from the standard library sources.

libgrust/ChangeLog:

	* libformat_parser/generic_format_parser/src/lib.rs: Add IsSomeAnd<T>
	trait, impl it for Option<T>.
gcc/testsuite/ChangeLog:

	* rust/compile/bad_stmt_enums.rs: Adjust redefinition error.
	* rust/compile/bad_toplevel_enums.rs: Likewise.
	* rust/compile/redef_error1.rs: Likewise.
	* rust/compile/redef_error3.rs: Likewise.
	* rust/compile/redef_error4.rs: Likewise.
	* rust/compile/redef_error6.rs: Likewise.

Signed-off-by: Owen Avery <[email protected]>
gcc/rust/ChangeLog:

	* expand/rust-macro-builtins.cc: Change BuiltinMacro in
	builtin_macro_from_string to tl::optional<>
	* expand/rust-macro-builtins.h (enum class): Change BuiltinMacro
	in builtin_macro_from_string to tl::optional<>
	* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit):
	Resolved wrong type dependency of builtin_macro_from_string

Signed-off-by: jjasmine <[email protected]>
gcc/rust/ChangeLog:

	* Make-lang.in: Compile new rust-lang-item.o.
	* util/rust-lang-item.h: Split into header and source.
	* util/rust-lang-item.cc: Cleanup parsing of lang items by using a hashmap
	and returning optional values, cleanup handling of exhaustive lang item
	lookups.
	* hir/rust-ast-lower-base.cc (ASTLoweringBase::handle_lang_item_attribute): Use
	new optional API.
…up ns.

gcc/rust/ChangeLog:

	* util/rust-lang-item.h (class RustLangItem): Renamed to...
	(class LangItem): ...this. Rename ItemType enum to Kind
	* util/rust-lang-item.cc: Rename methods to use new class name.
	* backend/rust-compile-expr.cc (CompileExpr::visit): Use new lang-item API.
	(CompileExpr::resolve_operator_overload): Likewise.
	* backend/rust-compile-expr.h: Likewise.
	* hir/rust-ast-lower-base.cc (ASTLoweringBase::handle_lang_item_attribute): Likewise.
	* typecheck/rust-autoderef.cc (Adjuster::try_deref_type): Likewise.
	(AutoderefCycle::cycle): Likewise.
	* typecheck/rust-autoderef.h: Likewise.
	* typecheck/rust-hir-type-bounds.h: Likewise.
	* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): Likewise.
	* typecheck/rust-hir-type-check-base.h: Likewise.
	* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise.
	* typecheck/rust-hir-type-check-expr.h: Likewise.
	* typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::visit): Likewise.
	* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): Likewise.
	(TypeBoundsProbe::assemble_builtin_candidate): Likewise.
	(TypeCheckBase::get_predicate_from_bound): Likewise.
	* typecheck/rust-tyty.cc (ClosureType::setup_fn_once_output): Likewise.
	* util/rust-hir-map.cc (Mappings::get_lang_item): Likewise.
	(Mappings::lookup_trait_item_lang_item): Likewise.
	* util/rust-hir-map.h: Likewise.
gcc/rust/ChangeLog:

	* resolve/rust-ast-resolve-implitem.h: Declare external types as new
	types.
gcc/rust/ChangeLog:

	* hir/tree/rust-hir-item.h (class ExternalTypeItem): New class.
	* hir/tree/rust-hir.cc (ExternalTypeItem::as_string): Likewise.
	* backend/rust-compile-extern.h: Add base for handling HIR::ExternalTypeItem
	node.
	* checks/errors/borrowck/rust-bir-builder-struct.h: Likewise.
	* checks/errors/borrowck/rust-function-collector.h: Likewise.
	* checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise.
	* checks/errors/rust-const-checker.h: Likewise.
	* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise.
	* checks/errors/rust-unsafe-checker.h: Likewise.
	* hir/rust-ast-lower-extern.h: Likewise.
	* hir/rust-hir-dump.cc (Dump::visit): Likewise.
	* hir/rust-hir-dump.h: Likewise.
	* hir/tree/rust-hir-full-decls.h (class ExternalTypeItem): Likewise.
	* hir/tree/rust-hir-visitor.h: Likewise.
	(ExternalTypeItem::accept_vis): Likewise.
	* typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): Likewise.
	* typecheck/rust-hir-type-check-implitem.h: Likewise.
gcc/rust/ChangeLog:

	* hir/rust-ast-lower-extern.h: Lower to HIR::ExternalTypeItem nodes.
	* hir/tree/rust-hir-item.h (class ExternalTypeItem): Create private
	visibility by default as extern types have no visibility - add a comment
	about the correctness of this.
gcc/rust/ChangeLog:

	* resolve/rust-default-resolver.cc
	(DefaultResolver::visit): Visit inner AST nodes of ClosureExprInner,
	ClosureExprInnerTyped, IfExpr, IfExprConseqElse, MatchExpr,
	PathInExpression, EnumItemTuple, EnumItemStruct, and
	EnumItemDiscriminant.
	* ast/rust-item.h
	(EnumItemDiscriminant::has_expr): New function.

Signed-off-by: Owen Avery <[email protected]>
CohenArthur and others added 27 commits August 1, 2024 13:12
gcc/rust/ChangeLog:

	* backend/rust-compile-resolve-path.cc: Attempt to resolve names
	also using new name resolution context.
	* backend/rust-compile-resolve-path.h: Add new declaration.
gcc/testsuite/ChangeLog:

	* rust/compile/name_resolution13.rs: Add new module and remove compile
	step.
	* rust/compile/name_resolution14.rs: New test.
	* rust/compile/name_resolution15.rs: New test.
	* rust/compile/name_resolution16.rs: New test.
	* rust/compile/name_resolution17.rs: New test.
	* rust/compile/name_resolution18.rs: New test.
	* rust/compile/name_resolution19.rs: New test.
	* rust/compile/name_resolution20.rs: New test.
	* rust/compile/name_resolution21.rs: New test.
Add a few test for globbing to highlight function call ambiguities.

gcc/testsuite/ChangeLog:

	* rust/compile/name_resolution23.rs: New test.
	* rust/compile/name_resolution24.rs: New test.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
GCC 4.8 does not handle pair with references correctly. We need to use a
properly typed struct instead.

gcc/rust/ChangeLog:

	* resolve/rust-forever-stack.h: Change dfs function prototype and
	declare dfs return type structure.
	* resolve/rust-forever-stack.hxx: Adapt dfs function to the new return
	type.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
gcc/rust/ChangeLog:

	* lex/rust-lex.cc
	(Lexer::parse_raw_byte_string):
	Bring handling of edge cases to par with parse_byte_string.

gcc/testsuite/ChangeLog:

	* rust/compile/raw-byte-string-loc.rs: New test.

Signed-off-by: Owen Avery <[email protected]>
gcc/rust/ChangeLog:

	* util/rust-attribute-values.h
	(Attributes::RUSTC_DEPRECATED): New.
	* util/rust-attributes.cc
	(__definitions): Add Attributes::RUSTC_DEPRECATED.

gcc/testsuite/ChangeLog:

	* rust/compile/deprecated-fn.rs: New test.

Signed-off-by: Owen Avery <[email protected]>
gcc/rust/ChangeLog:

	* util/rust-attribute-values.h
	(Attributes::UNSTABLE): New.
	* util/rust-attributes.cc
	(__definitions): Add Attributes::UNSTABLE.

gcc/testsuite/ChangeLog:

	* rust/compile/unstable-fn.rs: New test.

Signed-off-by: Owen Avery <[email protected]>
gcc/rust/ChangeLog:

	* parse/rust-parse-impl.h
	(Parser::parse_vis_item):
	Call parse_function instead of parse_async_item when finding
	UNSAFE or EXTERN_KW during lookahead.

gcc/testsuite/ChangeLog:

	* rust/compile/func-const-unsafe.rs: New test.

Signed-off-by: Owen Avery <[email protected]>
gcc/rust/ChangeLog:

	* lex/rust-lex.cc
	(Lexer::parse_raw_string):
	Bring handling of edge cases to par with parse_raw_byte_string.

gcc/testsuite/ChangeLog:

	* rust/compile/raw-string-loc.rs: New test.

Signed-off-by: Owen Avery <[email protected]>
The error is actually expected and uses the correct location.

gcc/testsuite/ChangeLog:

	* rust/compile/raw-byte-string-loc.rs: Use dg-error instead of
	dg-excess-error.
	* rust/compile/raw-string-loc.rs: Likewise.
Never can... never... exist, so it should always be coerced to the type
it is being matched against. This is useful for breaking off of a loop
from inside a match, or an if condition, for example.

gcc/rust/ChangeLog:

	* typecheck/rust-unify.cc (UnifyRules::go): Always unify to `ltype` if
	we are matching against a `Never` in `rtype`.
	(UnifyRules::expect_never): Always unify to the expected type.

gcc/testsuite/ChangeLog:

	* rust/compile/match-never-ltype.rs: New test.
	* rust/compile/match-never-rtype.rs: New test.
Replace direct usage of system headers.

gcc/rust/ChangeLog:

	* checks/errors/borrowck/rust-bir-dump.cc: Use rust-system.h
	* checks/errors/borrowck/rust-bir-dump.h (RUST_BIR_DUMP_H): Use rust-system.h
	* checks/errors/borrowck/rust-bir-place.h (RUST_BIR_PLACE_H): Use rust-system.h
	* checks/errors/borrowck/rust-function-collector.h: Use rust-system.h
	* rust-system.h: Use rust-system.h
	* typecheck/rust-hir-type-check.h: Use rust-system.h
	* typecheck/rust-tyty-subst.cc: Use rust-system.h
	* typecheck/rust-tyty-subst.h: Use rust-system.h
	* typecheck/rust-tyty.h: Use rust-system.h

Signed-off-by: Jakub Dupak <[email protected]>
gcc/rust/ChangeLog:

	* checks/errors/borrowck/bir-design-notes.md (nodes): Rename node to statement.
	(Nodes): Rename node to statement.
	* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit):
	Rename node to statement.
	* checks/errors/borrowck/rust-bir-builder-internal.h: Rename node to statement.
	* checks/errors/borrowck/rust-bir-builder.h: Rename node to statement.
	* checks/errors/borrowck/rust-bir-dump.cc (Dump::go): Rename node to statement.
	(Dump::visit): Rename node to statement.
	* checks/errors/borrowck/rust-bir-dump.h (class Dump): Rename node to statement.
	* checks/errors/borrowck/rust-bir-visitor.h (class Node): Rename node to statement.
	(class Statement): Rename node to statement.
	* checks/errors/borrowck/rust-bir.h (class Node): Rename node to statement.
	(class Statement): Rename node to statement.
	(class AbstractExpr): Rename node to statement.
	(struct Function): Rename node to statement.
	(struct BasicBlock): Rename node to statement.

Signed-off-by: Jakub Dupak <[email protected]>
gcc/rust/ChangeLog:

	* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit):
	Use callable API

Signed-off-by: Jakub Dupak <[email protected]>
gcc/rust/ChangeLog:

	* checks/errors/borrowck/rust-bir-place.h:
	Create place tree traverse API.

Signed-off-by: Jakub Dupak <[email protected]>
gcc/rust/ChangeLog:

	* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::setup_loop):
	Loop handling.
	(ExprStmtBuilder::visit): Handle scopes.
	* checks/errors/borrowck/rust-bir-builder-internal.h (struct BuilderContext):
	Handle scopes.
	* checks/errors/borrowck/rust-bir-dump.cc (Dump::go): Dump scopes.
	(Dump::visit): Add scopes dump.
	(Dump::indent): Add indentation logic.
	(Dump::visit_scope): Dump scope.
	* checks/errors/borrowck/rust-bir-dump.h: Dump methods.
	* checks/errors/borrowck/rust-bir-place.h (std::numeric_limits::max): Scope constants.
	(struct Scope): Scope representation.
	(class PlaceDB): Scope tracking.

Signed-off-by: Jakub Dupak <[email protected]>
gcc/rust/ChangeLog:

	* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Emit moves.
	* checks/errors/borrowck/rust-bir-builder-internal.h: Emit moves.
	* checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h: Emit moves.
	* checks/errors/borrowck/rust-bir-dump.cc (Dump::visit_move_place): Emit moves.
	(Dump::visit): Emit moves.
	* checks/errors/borrowck/rust-bir-place.h (struct Place): Emit moves.
	* checks/errors/borrowck/rust-bir-visitor.h: Emit moves.
	* checks/errors/borrowck/rust-bir.h (enum class): Emit moves.
	(class AbstractExpr): Emit moves.
	(BasicBlock::is_terminated): Emit moves.

Signed-off-by: Jakub Dupak <[email protected]>
gcc/rust/ChangeLog:

	* checks/errors/borrowck/rust-bir-dump.cc (Dump::visit): const
	visitor
	* checks/errors/borrowck/rust-bir-dump.h: const visitor
	* checks/errors/borrowck/rust-bir-visitor.h: const visitor
	* checks/errors/borrowck/rust-bir.h: const getter

Signed-off-by: Jakub Dupak <[email protected]>
Rust part is not build and not invoked at this point.

gcc/rust/ChangeLog:

	* checks/errors/borrowck/ffi-polonius/Cargo.toml: New file.
	* checks/errors/borrowck/ffi-polonius/src/gccrs_ffi.rs: New file.
	* checks/errors/borrowck/ffi-polonius/src/gccrs_ffi_generated.rs: New file.
	* checks/errors/borrowck/ffi-polonius/src/lib.rs: New file.
	* checks/errors/borrowck/polonius/rust-polonius-ffi.h: New file.
	* checks/errors/borrowck/polonius/rust-polonius.h: New file.

Signed-off-by: Jakub Dupak <[email protected]>
gcc/rust/ChangeLog:

	* checks/errors/borrowck/rust-bir-free-region.h: New file.

Signed-off-by: Jakub Dupak <[email protected]>
Biggybag on variance analysis to extract regions of fields from ADT
regions.

gcc/rust/ChangeLog:

	* typecheck/rust-tyty-variance-analysis-private.h (class FieldVisitorCtx):
	Region extraction.
	* typecheck/rust-tyty-variance-analysis.cc (query_field_regions): Region extraction.
	(FieldVisitorCtx::collect_regions): Region extraction.
	(FieldVisitorCtx::add_constraints_from_ty): Region extraction.
	(FieldVisitorCtx::add_constraints_from_region): Region
	extraction.
	(FieldVisitorCtx::add_constrints_from_param): Region extraction.
	* typecheck/rust-tyty-variance-analysis.h (query_field_regions):
	Region extraction.

Signed-off-by: Jakub Dupak <[email protected]>
gcc/rust/ChangeLog:

	* checks/errors/borrowck/rust-bir-place.h (struct Lifetime):
	Extended regions and loans.
	(struct Loan): Representation of loan (result of borrowing)
	* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit):
	Fix let stmt handling.
	* checks/errors/borrowck/rust-bir-builder-pattern.h: improved
	pattern translation
	* checks/errors/borrowck/rust-bir-builder-internal.h: region binding
	* checks/errors/borrowck/rust-bir-builder-expr-stmt.h (class ExprStmtBuilder):
	Region support.
	(class RenumberCtx): Region support.
	* checks/errors/borrowck/rust-bir-builder.h (class Builder): Region support.
	* checks/errors/borrowck/rust-bir-dump.cc (get_lifetime_name): Region support.
	(renumber_places): Region support.
	(Dump::go): Region support.
	(Dump::visit): Region support.
	(Dump::visit_lifetime): Region support.
	(Dump::visit_scope): Region support.
	* checks/errors/borrowck/rust-bir.h (class AbstractExpr): Region support.
	(struct Function): Region support.
	(class BorrowExpr): Region support.
	(class CallExpr): Region support.

Signed-off-by: Jakub Dupak <[email protected]>
This is the main Polonius based logic which creates the information
Polonius needs from BIR. It is largly guessed and rever engineered, so
some aspects are probably wrong.

gcc/rust/ChangeLog:

	* checks/errors/borrowck/rust-bir-fact-collector.h: New file.
	* checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go):
	Enable fact collection.

Signed-off-by: Jakub Dupak <[email protected]>
gcc/rust/ChangeLog:

	* checks/errors/borrowck/rust-bir-dump.cc (renumber_places):
	Remove unecessary braces.
	(Dump::go): Remove unecessary braces.
	(Dump::visit): Remove unecessary braces.
	(Dump::visit_scope): Remove unecessary braces.
	* checks/errors/borrowck/rust-bir-fact-collector.h (class FactCollector):
	Remove unecessary braces.
	(points): Remove unecessary braces.
	* checks/errors/borrowck/rust-bir-free-region.h: Remove unecessary braces.
	* checks/errors/borrowck/rust-bir-place.h: Remove unecessary braces.
	* checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go):
	Remove unecessary braces.
	* checks/errors/borrowck/rust-function-collector.h: Remove unecessary braces.

Signed-off-by: Jakub Dupak <[email protected]>
gcc/rust/ChangeLog:

	* checks/errors/borrowck/ffi-polonius/src/gccrs_ffi.rs: Bump copyright.
	* checks/errors/borrowck/ffi-polonius/src/lib.rs: Bump copyright.
	* checks/errors/borrowck/polonius/rust-polonius-ffi.h: Bump copyright.
	* checks/errors/borrowck/polonius/rust-polonius.h: Bump copyright.
	* checks/errors/borrowck/rust-bir-dump.cc: Bump copyright.
	* checks/errors/borrowck/rust-bir-fact-collector.h: Bump copyright.
	* checks/errors/borrowck/rust-bir-free-region.h: Bump copyright.

Signed-off-by: Jakub Dupak <[email protected]>
Inherent impl has a type it applies to. This type
was not visited and thus not resolved.

gcc/rust/ChangeLog:

	* resolve/rust-default-resolver.cc (DefaultResolver::visit): Visit
	inherent impl type.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
A previous bug with name resolution 2.0 was caused by an incorrectly
resolved inherent impl name. This test shall highlight the behavior
and prevent regression.

gcc/testsuite/ChangeLog:

	* rust/compile/name_resolution25.rs: New test.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants